import numpy as np
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LogNorm

# define data directory
fname = 'exfig3a.npz'

# load npz file
data = np.load(fname, allow_pickle=True)
print(data.files)
#save data to variables
for key in data.files:
    exec(key + " = data['" + key + "']")

# plot
fig, ax = plt.subplots(1, 1, figsize=(6, 5))
fig.suptitle('exfig3a')

im = ax.pcolormesh(n, D, Rxx, rasterized=True, cmap='Spectral_r', norm=LogNorm(vmin=200, vmax=1e4))
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('$R_{xx}$ ($\Omega$)')
ax.set_xlabel('n (cm$^{-2}$)')
ax.set_ylabel(r'$D/\epsilon_0$ (V/nm)')
plt.show()